package com.bw.module_parking.adpter

import android.graphics.Color
import android.widget.TextView
import com.bw.module_parking.R
import com.bw.module_parking.entity.ParkingEntity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class ParkingAdapter: BaseQuickAdapter<ParkingEntity,BaseViewHolder>(R.layout.item_parking){
    override fun convert(holder: BaseViewHolder, item: ParkingEntity) {
        holder.setText(R.id.car_name,item.areaName)
        holder.setText(R.id.car_status,item.spaceStatus)
        holder.setText(R.id.car_area,"所属区域："+item.areaName)
        holder.setText(R.id.car_type,"车位类型："+item.spaceType)
        holder.setText(R.id.car_user,"使用人："+item.userName)
        holder.setText(R.id.car_code,"车牌号："+item.spaceNumber)

        val status = holder.getView<TextView>(R.id.car_status)
        if(status.equals("已占用")){
            status.setTextColor(Color.parseColor("#FF477CEF"))
            status.setBackgroundColor(Color.parseColor("#FFF1F7FF"))
        }else if(status.equals("维护中")){
            status.setTextColor(Color.parseColor("#FFCD9216"))
            status.setBackgroundColor(Color.parseColor("#FFFEFCE8"))
        }
    }

}